Repository navigation
Run Flower clients on a multi-node Ray cluster (FLTEST_RAY_ADDRESS) - #29
Merged
Merged
Conversation
Setting FLTEST_RAY_ADDRESS makes the Flower backend join an existing Ray cluster instead of starting a private single-machine Ray, so the simulated clients spread over every node. Without the variable nothing changes. Two things had to change. Ray refuses num_cpus/num_gpus when it connects to an existing cluster, so the backend passes only the address. And prepared shards were memory-mapped from the local Hugging Face cache; a memory-mapped table pickles as a file path, so clients scheduled on other nodes failed with FileNotFoundError and the run stalled with every client actor idle. On a cluster the shards are now kept in memory (separate cache key). Adds tests/test_multinode_ray.py and docs/multi-node.md. Verified on an 8-node, 128-vCPU Ray cluster on SPHERE: defense_robust.yaml reproduces the single-machine result (accuracy 0.8965, ASR 0.0270 vs 0.8945, 0.0346). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Flower pickles the client app with every message to a client, and the app held every client's loader. On a cluster the shards travel by value, so each message carried the whole federation's data: about 800 MB with 120 CIFAR-10 clients, which filled the head node's disk while spilling Ray objects. Each client's loader now goes into the object store once, and the client app holds only the references. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
There is bug in memory fix. Please dont merge yet. |
Author
|
Update (c15cfb9): a third change was needed at scale. Flower pickles the client app with every message, and the app held every client’s loader, so on a cluster each message carried the whole federation’s data (~800 MB with 120 CIFAR-10 clients), which filled the head node’s disk. Each client’s loader now goes into the Ray object store once and the app holds only references. Verified on the same 8-node SPHERE cluster; 120-client results to follow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Setting
FLTEST_RAY_ADDRESS=<head-ip>:6379makes the Flower backend join an existing Ray cluster instead of starting a private single-machine Ray, so a run's simulated clients spread over every node. With the variable unset, nothing changes.Why two changes were needed
num_cpus/num_gpuswhen it connects to an existing cluster, so the backend passes only the address (ray_backend_configinfltest/frameworks/flower/adapter.py).FileNotFoundErroron a cache file that exists only on the driver, and the run stalled with every client actor idle. On a cluster the shards are now kept in memory (keep_in_memoryinfltest/data/datasets.py, image and text paths), under a separate cache key, so cluster and single-machine runs never share cached shards.Tests and docs
tests/test_multinode_ray.py: 5 tests for both decisions. They need no network and no cluster. The full suite gives 123 passed and 1 skipped; the skip is the NVFlare contract test, which needs the optional extra.docs/multi-node.md: how to start a Ray cluster and point FLTest at it, and when it pays off. Also adds a mkdocs nav entry, a README pointer and a CHANGELOG entry under Unreleased.Verified on SPHERE
On an 8-node, 128-vCPU Ray cluster on the SPHERE testbed,
examples/configs/defense_robust.yamlreproduces the single-machine result: accuracy 0.8965 and ASR 0.0270, against 0.8945 and 0.0346 on one machine. A 120-client non-IID CIFAR-10 run (baseline, backdoor, median, trimmed mean) is in progress on the same cluster.🤖 Generated with Claude Code